package com.lhy.order.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.lhy.order.entity.Order;
import com.lhy.order.service.OrderService;
import com.lhy.order.vo.RuleFormVo;
import com.lhy.vaccine_common.vo.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/order/order")
public class OrderController {

    @Autowired
    private OrderService orderService;

    @PostMapping("/insertOrder")
    public R insertOrder(@RequestBody RuleFormVo ruleFormVo){

        R r = orderService.insertOrder(ruleFormVo);
        return r;
    }

    @GetMapping("/getOrderList/{currentPage}/{pageSize}")
    public R getOrderList(
            @PathVariable("currentPage") Integer currentPage,
            @PathVariable("pageSize") Integer pageSize
    ){
        R r = orderService.getOrderList(currentPage,pageSize);
        return r;
    }

    @PostMapping("/userInsertOrder")
    public R userInsertOrder(@RequestBody RuleFormVo ruleFormVo){

        R r = orderService.userInsertOrder(ruleFormVo);
        return r;
    }

    @GetMapping("/getOrderByUserId")
    public R getOrderByUserId(@RequestParam("uid") String uid){
        R r = orderService.getOrderByUserId(uid);
        return r;
    }
}
